package com.example.utils;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author wangxiyuan
 * @description
 * @createDate 2021/4/15 14:28
 **/
public class ConnectionFactoryUtils {
    public static ConnectionFactory getConnectionFactory(){
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("172.17.1.3");
        factory.setPort(5672);
        factory.setUsername("admin");
        factory.setPassword("Gand@o1102rabbitmq");
        return factory;
    }

    public static Connection getConnection() throws IOException, TimeoutException {
        return getConnectionFactory().newConnection();
    }
}
